home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Java for 3D & VRML Worlds
/
Java for 3d and VRML Worlds.iso
/
doc
/
homepage
/
tutorials
/
lesson5
/
musical.java
< prev
next >
Wrap
Text File
|
1996-08-21
|
771b
|
36 lines
/*
musical.java : source for sound tutorial
Written By : Jai Natarajan
Sony Pictures Imageworks
*/
import vrml.*;
import vs.*;
public class musical extends Script {
SFTime musicOn = (SFTime)getEventOut("musicOn");
SFTime musicOff = (SFTime)getEventOut("musicOff");
boolean musicPlaying = false;
public musical() { }
public void clicked(ConstSFBool ev, ConstSFTime time) {
double now = time.getValue();
if(ev.getValue() == true) {
return;
}
else {
if(!musicPlaying) { // we need to switch it on
musicOn.setValue(now);
}
else { // switch it off
musicOff.setValue(now);
}
musicPlaying = !musicPlaying;
}
}
}